package com.yjd.comm.rpm;

import com.yjd.comm.util.FrameUtil;
import com.yjd.comm.vo.Constant.PropertiesFileEnum;

/**
 * <b>description</b>：远程对象常量 <br>
 * <b>time</b>：2015-6-1下午3:34:27 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public enum RpmServiceKeyEnum {

	/**
	 * public service rpm url对应的key
	 */
	RPM_PUBLIC_KEY_E(RpmServiceKeyEnum.RPM_PUBLIC_KEY),
	/**
	 * job rpm url对应的key
	 */
	RPM_JOB_KEY_E(RpmServiceKeyEnum.RPM_JOB_KEY),
	/**
	 * job service rpm url对应的key
	 */
	RPM_JOB_SERVICE_KEY_E(RpmServiceKeyEnum.RPM_JOB_SERVICE_KEY),
	/**
	 * 实名认证service rmp url对应的key
	 */
	RPM_AUTH_SERVICE_KEY_E(RpmServiceKeyEnum.RPM_AUTH_SERVICE_KEY),
	/**
	 * 短信service rmp url对应的key
	 */
	RPM_SMS_SERVICE_KEY_E(RpmServiceKeyEnum.RPM_SMS_SERVICE_KEY),
	/**
	 * jms
	 */
	RPM_JMS_SERVICE_KEY_E(RpmServiceKeyEnum.RPM_JMS_SERVICE_KEY),
	/**
	 * 推送系统
	 */
	RPM_PUSH_SERVICE_KEY_E(RpmServiceKeyEnum.RPM_PUSH_SERVICE_KEY);


	private String rpmServiceUrlKey;
	public static final String RPM_PUBLIC_KEY = "rpm_service_url.public.remote.serviceurl";
	public static final String RPM_JOB_KEY = "rpm_service_url.job.remote.serviceurl";
	public static final String RPM_JOB_SERVICE_KEY = "rpm_service_url.job_service.remote.serviceurl";
	public static final String RPM_AUTH_SERVICE_KEY = "rpm_service_url.auth.remote.serviceurl";
	public static final String RPM_SMS_SERVICE_KEY = "rpm_service_url.sms.remote.serviceurl";
	public static final String RPM_JMS_SERVICE_KEY = "rpm_service_url.jms.remote.serviceurl";
	public static final String RPM_PUSH_SERVICE_KEY = "rpm_service_url.push.remote.serviceurl";

	private RpmServiceKeyEnum(String rpmServiceUrlKey){
		this.rpmServiceUrlKey = rpmServiceUrlKey;
	}

	public String getRpmServiceUrlKey(){
		return this.rpmServiceUrlKey;
	}

	public String getRpmServiceUrl(){
		return FrameUtil.getResourceByFile(PropertiesFileEnum.RPM_SERVICE.getFilename(),this.getRpmServiceUrlKey());
	}

	public static RpmServiceKeyEnum getRpmServiceKeyEnumByRpmKey(String rpmKey){
		RpmServiceKeyEnum [] enums = RpmServiceKeyEnum.values();
		for (RpmServiceKeyEnum e : enums) {
			if(e.getRpmServiceUrlKey().equals(rpmKey)){
				return e;
			}
		}
		return null;
	}
}
